package com.task.scheduler.event;

import com.task.scheduler.enums.TaskStatus;
import com.task.scheduler.model.GenericTask;
import org.springframework.context.ApplicationEvent;

/**
 * 任务完成事件
 * 当任务被成功消费后发布该事件，供监听器处理后续逻辑
 */
public class TaskEvent extends ApplicationEvent {

    private final String taskType;         // 任务类型
    private final GenericTask task;      // 原始任务对象
    private final String result;         // 执行结果
    private final TaskStatus status;     // 执行状态

    public TaskEvent(Object source, String taskType, GenericTask task, String result, TaskStatus status) {
        super(source);
        this.taskType = taskType;
        this.task = task;
        this.result = result;
        this.status = status;
    }

    public String getTaskType() {
        return taskType;
    }

    public GenericTask getTask() {
        return task;
    }

    public String getResult() {
        return result;
    }

    public TaskStatus getStatus() {
        return status;
    }
}
